class Solution {
public:
    int removeDuplicates(vector<int>& nums) {
        int n = nums.size();
        if (n == 0) return 0;
        int left = 1, right = 1;
        while (right < n)
        {
            if (nums[right] != nums[right - 1]) {
                nums[left] = nums[right];
                left++;
            }
            right++;
        }
        return left;
    }
};

class Solution {
public:
    int f(int n, int m)
    {
        if (n == 1) return 0;
        int x = f(n - 1, m);
        return (x + m) % n;
    }
    int iceBreakingGame(int num, int target) {
        return f(num, target);
    }
};